package com.beep.erp.model.purchase;

import com.beep.erp.common.base.BaseBean;
import com.beep.erp.common.bean.PurchaseListBean;
import com.beep.erp.http.HttpExceptionHandle;
import com.beep.erp.http.HttpResultSubscriber;

/**
 * FileName: TopicalPresenter.java
 * Author: Jolly
 * Date 2018/8/24
 */

public class PurchaseListPresenter extends PuchaseListContract.Presenter {
    @Override
    public void onStart() {
        mView.getData();
    }

    @Override
    public void getPurchaseData(String sign, String timeStamp, int status, int pageSize, int pageNo) {

        mRxManage.add(mModel.getPurchaseData(sign, timeStamp, status, pageSize, pageNo).subscribe(new HttpResultSubscriber<PurchaseListBean>() {
            @Override
            public void onError(HttpExceptionHandle.ResponeThrowable e) {
                mView.hideLoading();
                mView.showMessage(e.ErrorInfo);
            }

            @Override
            public void onNext(PurchaseListBean purchaseListBean) {
                mView.hideLoading();
                mView.getPurchaseData(purchaseListBean);
            }
        }));
    }
}
